<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>async延时函数</title>
  </head>
  <body>
    <script>
      async function sleep(delay = 2000) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve();
          }, delay);
        });
      }
      async function show() {
        for (const user of ["后盾人", "向边"]) {
          await sleep();
          console.log(user);
        }
      }
      show();
    </script>
  </body>
</html>
